#include "stdafx.h"
#include "PopupThread.h"

int PopupThread::start(ThreadRoutine p_routine, void *p_args)
{
  WrapperArgs *_wrapper = new WrapperArgs(p_routine, p_args);
  _beginthread(threadRoutineWrapper, 0, _wrapper);
  return 0;
}
void PopupThread::threadRoutineWrapper(void *p_args)
{
  WrapperArgs *_wrapper = (WrapperArgs*) p_args;
  _wrapper->run();
  delete _wrapper;
}

PopupThread::WrapperArgs::WrapperArgs(ThreadRoutine p_routine, void *p_args)
 : m_routine(p_routine), m_args(p_args) {}

void PopupThread::WrapperArgs::run()
{
	m_routine(m_args); 
}